<?php
namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\AdverImage;
use Dingo\Api\Http\Request;

class BannerController extends Controller
{
    protected $model;

    public function __construct(AdverImage $adverImage )
    {
        $this->model = $adverImage;
    }

    public function getBanner(Request $request)
    {     
        //$machineId = $request->machineId;
        $domain = "http://".$_SERVER['HTTP_HOST'];

        $result = $this->model
            //->where('machine_id',$machineId)
            ->where('available',0)
            ->get();
        $data = [];
        if($result){
            foreach ($result as $k => $v){
                //$data[$k][$v->adver_image] = $domain.$v->adver_image;
                $data[$k]['image'] = $domain.$v->adver_image;
            }
        }
        return $this->success($data);

    }

  

}
